<!DOCTYPE html>
<!--培训归档-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta itemScore="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

</head>

<body>
    
<div id="app" v-cloak>   
        <el-form label-position="right" :model="Form" status-icon :rules="rules" ref="ruleForm" label-width="100px"
            size="mini">
            <el-row>
                <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        <div> {{TrainingArchive.itemScore+mark.m}}</div>
                                    </template>
                                    <el-select @visible-change="visibleChange" @input="getScope" v-model="Form.itemScore" slot="suffix"
                                        :placeholder="TrainingArchive.itemScore">
                                        <el-option label="请选择" value=""></el-option>
                                        <el-option v-for="item in itemScore" :label="item.value" :value="item.value">
                                        </el-option>
                                    </el-select>
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>
                <el-col :span="11" :offset="2">
                    <div class="elst-select-mini">
                        <!-- <el-form-item>
                            <el-input type="text" v-model="Form.scope" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{TrainingArchive.scope+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item> -->
                        {{TrainingArchive.scope+mark.m}}
                        <span>{{Form.scope}}</span>
                    </div>
                </el-col>
            </el-row>
            <el-row type="flex" justify="end">
                <el-form-item>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSave}}</el-button>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnCommit}}</el-button>
                    <el-button type="primary" @click="parent.ListItem.dialogVisible=false">{{col.btnBack}}</el-button>
                </el-form-item>
            </el-row>
        </el-form>
    </div>
    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                id: '',
                type: '',
                itemScore: [],
                //业务表单内容
                Form: {
                    id: '',
                    itemScore: "",
                    scope: "0",
                },
                IsConsumables: [],
                //表单验证
                rules: {
                    PersonnelitemScore: [
                        verification.NotNull,
                        { pattern: verification.StringLengthAtoB.t.format(2, 5), message: verification.StringLengthAtoB.m.format(2, 5), trigger: 'blur' }
                    ],
                    ContractoritemScore: [
                        verification.NotNull,
                        { pattern: verification.StringLengthAtoB.t.format(5, 50), message: verification.StringLengthAtoB.m.format(5, 10), trigger: 'blur' }
                    ],

                }
            },
            // updated() {
            //     this.getScope()
            // },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                getScope: function () {
                    if (this.Form.itemScore == null) {
                        this.Form.scope = 0;
                    } else {
                        this.Form.scope = Mock.mock({
                            "number|1-5": 5
                        }).number;
                    }
                },
                handleChange: function (value) {
                    console.log(value);
                },
                //提交数据
                onSubmitForm: function (formitemScore) {
                    var mythis = this;
                    this.$refs[formitemScore].validate(function (valid) {
                        //验证通过
                        if (valid) {

                            onSubmitForm(this, '/api/TrainingArchive/Save', mythis.Form);
                        } else {
                            //验证失败
                            return false;
                        }
                    });
                },
                getData: function () {
                    getData(this, '/api/TrainingArchive/get?id=' + this.id);
                    this.Form.itemScore = this.Form.itemScore + "";
                },
            },
            mounted: function () {
                this.itemScore = getDicData('w63');
                this.IsConsumables = getDicData('50');
                this.id = getUrlParam("id");
                this.type = getUrlParam("type");
                if (this.type != 'tj') {
                    this.getData();
                } else {
                    this.Form.id = this.id;
                }
            }
        });
    </script>
</body>

</html>